<template>
  <div id="app">
    <h1 @click="fun">测测试</h1>
    <Header />
    <router-view></router-view>
    <Footer v-show="$route.meta.show"></Footer>
  </div>
</template>

<script>
import Header from "./components/Header";
import Footer from "./components/Footer";
export default {
  name: "App",
  components: {
    Header,
    Footer,
  },
  mounted() {
    this.$store.dispatch("categoryList");
  },
  methods: {
    fun() {
      let arr = [0, -100, 15, 30, 60, -2, 3, 1];
      let quickSort = (arr, left, right) => {
        let l = left;
        let r = right;
        let p = arr[(left + right) / 2];
        let temp = 0;
        while (l < r) {
          while (arr[l] < p) {
            l += 1;
          }
          while (arr[r] > p) {
            r -= 1;
          }
          if (l >= r) {
            break;
          }
          temp = arr[l];
          arr[l] = arr[r];
          arr[r] = temp;
          if (arr[l] == p) {
            r -= 1;
          }
          if (arr[r] == p) {
            l += 1;
          }
        }
        if (r == l) {
          l += 1;
          r -= 1;
        }
        if (left < r) {
          quickSort(arr, left, r);
        }
        if (right > l) {
          quickSort(arr, l, right);
        }
      };
      quickSort(arr, 0, arr.length);
      console.log(arr);
    },
  },
};
</script>

<style></style>
